package com.example.common.dao;


import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.io.Serializable;
import java.util.List;

/**
 * ${DESCRIPTION}
 */

@NoRepositoryBean //接口不参与jpa的代理
public interface BaseJpaRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T>, Serializable {

    Page<T> findByAuto(T example, Pageable pageable);

    List<T> findByAuto(T example);

    public List<T> findByAuto(Specification<T> specification);

    List<?> findByHql(String hql);

    T findByIdNew(ID id);

    public void lazyInitialize(Class<T> entityClazz, List<T> l, String[] fields);

    public void lazyInitialize(T obj, String[] fields);
}
